/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package sr;

import java.net.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.PageContext;

/**
 *
 * @author Phuc Tran
 */
public class Link {

    public static String getURLWithContextPath(HttpServletRequest request) {
        return request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath();
    }
    
    public static String getURL(HttpServletRequest request) {
        return request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort();
    }
    
    public static String toCity(HttpServletRequest request, String cityId) {
        return getURLWithContextPath(request) + "//home.jsp?CityID=" + cityId;
    }
    
    public static String toHotel(HttpServletRequest request, String cityId) {
        return getURLWithContextPath(request) + "//hotelDetail.jsp?HotelID=" + cityId;
    }
    
    public static String toOrderPage(HttpServletRequest request, String cityId) {
        return getURLWithContextPath(request) + "//orderPage.jsp?HotelID=" + cityId;
    }
}
